#include "../func.h"

void sig(int signum, siginfo_t* p, void* p1)
{
    printf("before sleep, %d signum is coming\n", signum);
    sleep(5);
    printf("after sleep, %d signum is coming\n", signum);
}

int main()
{
    struct sigaction act;
    memset(&act, 0, sizeof(act));
    act.sa_sigaction = sig;
    act.sa_flags = SA_SIGINFO;
    sigemptyset(&act.sa_mask);
    sigaddset(&act.sa_mask, SIGQUIT);
    int ret;
    ret = sigaction(SIGINT, &act, NULL);
    if (-1 == ret)
    {
        perror("sigaction");
        return -1;
    }

    while(1);
}
